package bist.believeinstep.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import bist.believeinstep.domain.TourPrice;
import bist.believeinstep.util.Constant.PriceState;

public class TourPriceMapper implements RowMapper<TourPrice>{
	public TourPrice mapRow(ResultSet rs, int rowNum) throws SQLException{
		
		TourPrice tourPrice = new TourPrice();
		
		tourPrice.setId(rs.getInt("id"));
		tourPrice.setBabyPrice(rs.getBigDecimal("baby_price"));
		tourPrice.setAdultPrice(rs.getBigDecimal("adult_price"));
		tourPrice.setChildrenPrice(rs.getBigDecimal("children_price"));
		
		String priceState = rs.getString("state");
		tourPrice.setState(PriceState.create(priceState));
		tourPrice.setCreated(rs.getTimestamp("created_date"));
		tourPrice.setModified(rs.getTimestamp("modified_date"));
		tourPrice.setCreatedBy(rs.getString("created_by"));
		tourPrice.setModifiedBy(rs.getString("modified_by"));
		
		return tourPrice;
		
	}
}
